Skip to content

test(angular-query-experimental/injectMutation): switch 'error' test to '@Component' + 'render' pattern#10589

Merged
sukvvon merged 1 commit intomainfrom
test/angular-query-inject-mutation-error-render-pattern
Apr 26, 2026
Merged

test(angular-query-experimental/injectMutation): switch 'error' test to '@Component' + 'render' pattern#10589
sukvvon merged 1 commit intomainfrom
test/angular-query-inject-mutation-error-render-pattern

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 26, 2026

🎯 Changes

Switch should return error when request fails in injectMutation to the @Component + @testing-library/angular render() pattern, matching the previously converted should return data when request succeeds and should reset state after invoking mutation.reset tests in the same file. All signals previously checked via expectSignals (isIdle, isPending, isError, isSuccess, data, error) are preserved by rendering them into the template and asserting via getByText.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Improved mutation error handling test coverage with enhanced verification of error states and UI output.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 03d6909d-e97a-429b-b87b-3e977e2bb87f

📥 Commits

Reviewing files that changed from the base of the PR and between d78883b and e93c019.

📒 Files selected for processing (1)
  • packages/angular-query-experimental/src/__tests__/inject-mutation.test.ts

📝 Walkthrough

Walkthrough

A single test in the Angular Query experimental package is refactored from using TestBed.runInInjectionContext with signal-level assertions to a component-based approach that renders the mutation in a template and verifies DOM output, triggering the mutation and asserting on rendered UI signals.

Changes

Cohort / File(s) Summary
Test Pattern Refactoring
packages/angular-query-experimental/src/__tests__/inject-mutation.test.ts
Refactored "request fails" test to use component rendering and DOM assertions instead of signal-level TestBed assertions; now verifies mutation UI output (idle, pending, error, success, data, error message) through rendered template.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

package: angular-query-experimental

Poem

🐰 From signals bare to DOM so true,
The test now renders what we do,
Click, advance, and DOM appears,
Component-tested, crystal clear!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: refactoring a test to use the @Component + render pattern, which is the primary modification in the changeset.
Description check ✅ Passed The description includes all required template sections: detailed changes explaining the refactoring, completed checklists confirming contribution guide compliance and local testing, and release impact marked as dev-only with no changeset needed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/angular-query-inject-mutation-error-render-pattern

Comment @coderabbitai help to get the list of available commands and usage tips.

@sukvvon sukvvon self-assigned this Apr 26, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 26, 2026

View your CI Pipeline Execution ↗ for commit e93c019

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 5s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-26 06:02:33 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 26, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10589

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10589

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10589

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10589

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10589

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10589

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10589

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10589

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10589

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10589

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10589

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10589

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10589

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10589

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10589

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10589

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10589

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10589

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10589

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10589

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10589

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10589

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10589

commit: e93c019

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.1 KB (0%)
react minimal 9.07 KB (0%)

@sukvvon sukvvon merged commit e69e5d2 into main Apr 26, 2026
10 checks passed
@sukvvon sukvvon deleted the test/angular-query-inject-mutation-error-render-pattern branch April 26, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant